package com.yitiao.data_algorithms.leetcode.editor.cn;
import com.yitiao.data_algorithms.leetcode.editor.cn.base.TreeNode;

class ErChaShuDeJingXiangLcof{
    // 2022-08-15 13:56:35
    //leetcode submit region begin(Prohibit modification and deletion)
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode(int x) { val = x; }
 * }
 */
class Solution {
    public TreeNode mirrorTree(TreeNode root) {
        dfs(root);
        return root;
    }

    private void dfs(TreeNode root) {
        if (root==null)return;
        dfs(root.left);
        dfs(root.right);
        TreeNode node = root.left;
        root.left = root.right;
        root.right = node;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}